from flask import Blueprint,request,jsonify
import random
from rediscon import r
bp_user = Blueprint("user",__name__)
#发送验证码接口
@bp_user.route('/smscode')
def smscode():
    #获取手机号
    mobile = request.args.get('mobile')
    #生成验证码
    code = str(random.randint(10000,99999))
    #把验证码存入redis
    r.set_str(mobile,code,60)
    #返回结果
    return jsonify({"code":200,'scode':code})